package list;

import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;

/**
 * Created by SliverZhang on 2017/11/20.
 */
public class TestListIterator {
    public static void main(String[] args) {
        List<String > all = new ArrayList<>();
        all.add("AA");
        all.add("BB");
        all.add("CC");
        System.out.println("由前向后输出");
        ListIterator<String> listIterator = all.listIterator();
        while (listIterator.hasNext()){
            String str = listIterator.next();
            System.out.println(str + "、");
        }
        System.out.println("\n由后向前输出：");
        while (listIterator.hasPrevious()){
            String str = listIterator.previous();
            System.out.println(str+"、");
        }









    }
}
